package me.xplabs.ui 
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author loo
	 */
	public class UICompent 
	{
		private static var totalSprite:Sprite;
		private static var target:*;
		
		public function UICompent() 
		{
		}
		public static function addListener(ptarget:*):void {
			ptarget.addEventListener(MouseEvent.MOUSE_DOWN, startDragFunc);
			ptarget.addEventListener(MouseEvent.MOUSE_UP, stopDragFunc);
			ptarget.addEventListener(MouseEvent.MOUSE_WHEEL, tracePosition);
			//ptarget.doubleClickEnabled = true;
			target = ptarget;
			
		}
		
		private static function tracePosition(e:MouseEvent):void 
		{
			/*if (e.currentTarget is Panel) {
				var pw:int = (e.currentTarget as Panel).width;
				var ph:int = (e.currentTarget as Panel).height;
				if (!e.ctrlKey && !e.shiftKey) pw += e.delta;
				else if(!e.shiftKey) ph += e.delta;
				(e.currentTarget as Panel).setWH(pw, ph);
			}*/
			if(e.shiftKey)
				trace("坐标x为：" + e.currentTarget.x, "坐标y为：" + e.currentTarget.y, "宽度：" + e.currentTarget.width, "高度：" + e.currentTarget.height);
		}
		
		private static function stopDragFunc(e:MouseEvent):void 
		{
			e.currentTarget.stopDrag();
		}
		
		private static function startDragFunc(e:MouseEvent):void 
		{
			e.currentTarget.startDrag();
		}
	}

}